<template>
    <div>
        <div class="bpx" id='scrollDiv'>
                <div style="height:1rem">内容</div>
                  <div style="height:1rem">内容</div>
                    <div style="height:1rem">内容</div>
                     <div style="height:1rem">内容</div>
        </div>
    </div>
</template>
<script>
export default {
    mounted() {
        this.scroll()
    },
    methods:{
        scroll(){
            //获取节点
            var scrollDiv = document.getElementById('scrollDiv');
            //绑定事件
            scrollDiv.addEventListener('scroll', function() {
                console.log(scrollDiv.scrollTop);
                console.log('>>>>>>',scrollDiv.scrollHeight);
                console.log('11111',scrollDiv.clientHeight);
            });
        }
    }
}
</script>
<style scoped>
.bpx{
    height: 3rem;
    border:solid 1px red;
    overflow: auto;
}
</style>
